package com.otod.base.json;


/**
 * @author jqiu
 */
public class JsonSuccess {
	public static String factory(String info){
		String returnText;
		if(null!=info){
			returnText = "{\"success\":true,\"info\":\"" + info +"\"}";
		}else{
			returnText = "{\"success\":true,\"info\":\"操作成功\"}";
		}
		return returnText;
	}
	
	/**
	 * 构造成功json对象
	 * @param result   结果
	 * @param msgInfo  消息
	 * @return
	 */
	public static String factory(String result,String msgInfo){
		String returnText;
		if(null!=msgInfo){
			returnText = "{\"success\":true,\"info\":\"" + msgInfo +"\",\"result\":\""+result+"\"}";
		}else{
			returnText = "{\"success\":true,\"info\":\"操作成功\",\"result\":\""+result+"\"}";
		}
		return returnText;
	}
	
}
